import { request } from "@/utils/service"
import type * as obj from "./types/category"
import { IdForm, SelectData, SortRequest } from "../common/common"

/** 登录并返回 Token */
export function getTableDataApi() {
  return request<obj.TableData[]>({
    url: "/mp/category/list",
    method: "get"
  })
}

export function getSelectDataApi() {
  return request<SelectData[]>({
    url: "/mp/category/select",
    method: "get"
  })
}

export function saveSortDataApi(data: SortRequest) {
  return request<string>({
    url: "/mp/category/sort",
    method: "post",
    data
  })
}

export function saveTableDataApi(data: obj.CreateOrUpdateTableRequestData) {
  return request<string>({
    url: "/mp/category/save",
    method: "post",
    data
  })
}

export function deleteTableDataApi(data: IdForm) {
  return request<string>({
    url: "/mp/category/delete",
    method: "post",
    data
  })
}
